package com.lfk.justwetools.Utils;

import ohos.aafwk.ability.Ability;
import ohos.app.Context;
import ohos.aafwk.content.Intent;

/**
 * Created by liufengkai on 15/10/19.
 */
public class MPUtils {
    /**
     * 发送短信
     * @param context 传入的Context
     * @param number 传入的电话号
     * @param message 传入的信息
     */
    private void send(Context context,final String number, String message){
//        String SENT = "sms_sent";
//        String DELIVERED = "sms_delivered";
//        PendingIntent sentPI = PendingIntent.getActivity(context, 0, new Intent(SENT), 0);
//        PendingIntent deliveredPI = PendingIntent.getActivity(context, 0, new Intent(DELIVERED), 0);
//        context.registerReceiver(new BroadcastReceiver() {
//            @Override
//            public void onReceive(Context context, Intent intent) {
//                switch (getResultCode()) {
//                    case Ability.RESULT_OK:
//                        Log.i("====>", "Ability.RESULT_OK");
//                        break;
//                    case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
//                        Log.i("====>", "RESULT_ERROR_GENERIC_FAILURE");
//                        break;
//                    case SmsManager.RESULT_ERROR_NO_SERVICE:
//                        Log.i("====>", "RESULT_ERROR_NO_SERVICE");
//                        break;
//                    case SmsManager.RESULT_ERROR_NULL_PDU:
//                        Log.i("====>", "RESULT_ERROR_NULL_PDU");
//                        break;
//                    case SmsManager.RESULT_ERROR_RADIO_OFF:
//                        Log.i("====>", "RESULT_ERROR_RADIO_OFF");
//                        break;
//                }
//            }
//        }, new IntentFilter(SENT));
//        context.registerReceiver(new BroadcastReceiver() {
//            @Override
//            public void onReceive(Context context, Intent intent) {
//                switch (getResultCode()) {
//                    case Ability.RESULT_OK:
//                        Log.i("====>", "RESULT_OK");
//                        break;
//                    case Ability.RESULT_CANCELED:
//                        Log.i("=====>", "RESULT_CANCELED");
//                        break;
//                }
//            }
//        }, new IntentFilter(DELIVERED));
//        SmsManager smsManager = SmsManager.getDefault();
//        smsManager.sendTextMessage(number, null, message, sentPI, deliveredPI);
    }
}
